import {
    ACTION_SET_DEPARTDATE,
    ACTION_SET_ARRIVEDATE,
    ACTION_SET_DEPARTTIMESTR,
    ACTION_SET_ARRIVETIMESTR,
    ACTION_SET_DEPARTSTATION,
    ACTION_SET_ARRIVESTATION,
    ACTION_SET_TRAINNUMBER,
    ACTION_SET_DURATIONSTR,
    ACTION_SET_TICKETS,
    ACTION_SET_ISSCHEDUALVISIBLE,
    ACTION_SET_SEARCHPARSED,
} from './actions';
export default {
    //出发日期
    departDate(prevState = Date.now(), action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_DEPARTDATE:
                return payload;

            default:
                break;
        }

        return prevState;
    },
    //到达日期
    arriveDate(prevState = Date.now(), action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_ARRIVEDATE:
                return payload;

            default:
                break;
        }

        return prevState;
    },
    //出发时间  从服务端获取数据
    departTimeStr(prevState = null, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_DEPARTTIMESTR:
                return payload;

            default:
                break;
        }

        return prevState;
    },
    //到达时间
    arriveTimeStr(prevState = null, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_ARRIVETIMESTR:
                return payload;

            default:
                break;
        }

        return prevState;
    },
    //出发车站
    departStation(prevState = null, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_DEPARTSTATION:
                return payload;

            default:
                break;
        }

        return prevState;
    },
    //到达车站
    arriveStation(prevState = null, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_ARRIVESTATION:
                return payload;

            default:
                break;
        }

        return prevState;
    },
    //车次
    trainNumber(prevState = null, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_TRAINNUMBER:
                return payload;

            default:
                break;
        }

        return prevState;
    },
    //运行时间
    durationStr(prevState = null, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_DURATIONSTR:
                return payload;

            default:
                break;
        }

        return prevState;
    },
    //座次和售票渠道
    tickets(prevState = [], action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_TICKETS:
                return payload;

            default:
                break;
        }

        return prevState;
    },
    //小浮层弹出
    isSchedualVisible(prevState = false, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_ISSCHEDUALVISIBLE:
                return payload;

            default:
                break;
        }

        return prevState;
    },
    //解析location的url参数
    searchParsed(prevState = false, action) {
        const { type, payload } = action;
        switch (type) {
            case ACTION_SET_SEARCHPARSED:
                return payload;

            default:
                break;
        }

        return prevState;
    },
};
